package com.sskj.b70.p.activity;

import com.lzy.okgo.model.Response;
import com.sskj.b70.MyAppLication;
import com.sskj.b70.m.HttpConfig;
import com.sskj.b70.m.bean.HttpData;
import com.sskj.b70.m.http.JsonCallBack;
import com.sskj.b70.p.base.BasePresenter;
import com.sskj.b70.utils.ToastUtil;
import com.sskj.b70.v.activity.ApplyAgentPersonActivity;

public class ApplyAgentPersonPresenter extends BasePresenter<ApplyAgentPersonActivity> {
    public void sendCode() {

        httpService.getTradeSms(MyAppLication.getMobile())
                .execute(new JsonCallBack<HttpData>(this) {
                    @Override
                    public void _onSuccess(Response<HttpData> response) {
                        HttpData httpListData = response.body();
                        ToastUtil.showShort(httpListData.getMsg());
                        mView.onSendSmsSuccess();
                    }
                });
    }

    public void applyAgent(String code) {
        httpService.applyAgent(MyAppLication.getID(), code)
                .execute(new JsonCallBack<HttpData>(this) {
                    @Override
                    protected void _onSuccess(Response<HttpData> response) {
                        ToastUtil.showShort(response.body().getMsg());
                        if (response.body().getStatus() == HttpConfig.STATUS_OK) {
                            mView.finish();
                        } else {

                        }
                    }
                });
    }
}
